package com.hotel.controller;


import com.hotel.response.Result;
import com.hotel.service.AddressBookService;
import com.hotel.vo.AddressBookVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 地址管理 前端控制器
 * </p>
 *
 * @author Lin
 * @since 2022-06-16
 */
@Api(tags = "收货人信息管理")
@RestController
@RequestMapping("/addressBook")
public class AddressBookController {

    @Resource
    private AddressBookService service;

    @ApiOperation(value = "编辑信息")
    @GetMapping("/editAddress")
    public Result editAddress(@RequestParam(value = "id") String id){
        AddressBookVO addressBookVO = service.editAddressBook(id);
        return Result.ok().data("addressBook",addressBookVO);
    }

    @ApiOperation(value = "修改信息")
    @PutMapping("/updateAddress")
    public Result updateAddress(@RequestBody AddressBookVO addressBookVO){
        int i = service.updateAddressBook(addressBookVO);
        return Result.ok().data("updateAddressBook",i);
    }

}

